home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14297 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: ix.netcom.com!news
  2. From: jlilley@ix.netcom.com (John Lilley)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: g++ 2.5.8 -> 2.7.0 Syntax Error
  5. Date: 29 Mar 1996 16:53:51 GMT
  6. Organization: Netcom
  7. Message-ID: <4jh4iv$scq@dfw-ixnews6.ix.netcom.com>
  8. References: <boyseDozKHC.JyA@netcom.com>
  9. NNTP-Posting-Host: den-co11-03.ix.netcom.com
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-NETCOM-Date: Fri Mar 29 10:53:51 AM CST 1996
  13. X-Newsreader: WinVN 0.99.7
  14.  
  15. In article <boyseDozKHC.JyA@netcom.com>, boyse@netcom.com says...
  16. >
  17. >#include <stdlib.h>
  18. >enum Elt_Type {None, Tri_3, Tri_6, Quad_4, Tet_4};
  19. >
  20. >// Base class for elements
  21. >class Element
  22. >{
  23. >public:
  24. >
  25. >    int elt_number; // element number
  26. >    Elt_Type elt_type; // element type
  27. >    int n_nodes; // number of nodes
  28. >    int prop_id; // property ID
  29. >    int surf_id; // surface property ID
  30. >    int *nodes; // [n_nodes]
  31. >    float **node_coord; // [n_nodes] [3]
  32. >
  33. >    Element(void)
  34. >        : elt_number(0), elt_type(None), n_nodes(0),
  35. >          nodes(NULL), node_coord(NULL) {}; // Default constructor
  36. >};
  37. >
  38. >// 6 node triangular element
  39. >class Tri_6 : public Element
  40. >{
  41. >public:
  42. >    Tri_6(void) : Element() {}; // Default Constructor
  43. >};
  44. >
  45. >//  Element Utility Routines
  46. >Element *Next_Element(Element *ptr_elt)
  47. >{
  48. >    ptr_elt = new Tri_6(); //  ******* THIS IS THE OFFENDING LINE ********
  49. >    return ptr_elt;
  50. >}
  51.  
  52.  
  53. As a matter of style, dont use func(void) in declarations, use func().
  54.  
  55. The actual problem should be fixed with:
  56.  
  57.     ptr_elt = new Tri_6; // no () in new using default ctor
  58.  
  59. john lilley
  60.  
  61.